<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue compent</title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        {{ message }}
       <todo-item> </todo-item>
       <todo-item2> </todo-item2>
    </div>
  
</body>
<script>
    // 定义名为 todo-item 的全局组件
    Vue.component('todo-item', {
        template: '<li>这是个待办项</li>'
    })

    // 局部组件
    let TodoItem = {
        template: '<li>这是个待办项2</li>'
    }

    var app = new Vue({
        el: '#app',
        components: {
            'todo-item2': TodoItem
        },
        data: {
            message: 'Hello Vue!'
        }
    })
   
</script>

</html>